<?php
/* +----------------------------------------------------------------------
// | 	xaoam.com
// |	author:am
// |	gitee:https://gitee.com/xaoam/amAdmin
// |	email:hi@xaoam.com
// |	
// +----------------------------------------------------------------------*/
namespace app\admin\controller;
use think\Controller;
use think\Db;

class Basic extends Base {

    public function initialize(){
        parent::initialize();
		$this->resJson= ['code'=>0,'msg'=>'操作失败','data'=>''];
    }

    public function index(){
			$res = Db::name('basic')->where('id',1)->find();
			$this->assign('d_json',json_encode($res));
			return $this->fetch();
    }
	public function edit(){
		if(request()->isPost()){
			$data = request()->param();
			if($data){
				$res = Db::name('basic')->field(true)->where('id',1)->update($data);
				if($res){
				$this->reJson['code'] = 200;
				$this->reJson['msg']= '操作成功!';
				}
				return json($this->reJson);
			}
		}
	}

}
